package com.why.day05_work3.model;



//网络框架,Rxjava+Retrofit+okhttp
//okhttp:日志拦截器:4行; 缓存
//


import com.why.day05_work3.base.BaseModel;
import com.why.day05_work3.bean.NaviBean;
import com.why.day05_work3.net.HttpUtil;
import com.why.day05_work3.net.ResultCallBack;
import com.why.day05_work3.net.ResultSubscriber;
import com.why.day05_work3.net.RxUtils;

public class MainModel extends BaseModel {
    public void getData(final ResultCallBack<NaviBean> callBack) {

        addDisposable(
                HttpUtil.getInstance()
                        .getWanService()
                        .getNavi()
                        .compose(RxUtils.<NaviBean>rxSchedulerHelper())
                        .subscribeWith(new ResultSubscriber<NaviBean>() {
                            @Override
                            public void onNext(NaviBean naviBean) {
                                callBack.onSuccess(naviBean);
                            }
                        })
        );
    }
}
